package socket;
/**
 * aaaa
 *
 */
public class CutString {
	public static void main(String[] args) {
		 String a="aaaaabc";
		  System.out.println(a.substring(1,3));
		  System.out.println(fsubstring(a,2,4));
	}
	public static String fsubstring(String a,int l,int r)
	 {
		byte[] b = a.getBytes();
	    byte[] bb = new byte [r-l];
	    int n = b.length;
	    if(r>n||l<0)
	    return "ERROR!!!!";
	    for(int i=l;i<r;i++)
	    {
	     bb[i-l]=b[i];
	    }
	    String s = new String(bb);
	    return s;
	 }
}

